//
//  main.c
//  C_常见排序
//
//  Created by Robin Guo on 16/4/20.
//  Copyright © 2016年 Robin Guo. All rights reserved.
//

#include <stdio.h>

// 冒泡排序
void sort_maopao ();

int main(int argc, const char * argv[]) {

    // C 语言各种排序
    sort_maopao();
    
    return 0;
}

void sort_maopao (){
    
    int i,j,t;
    
    int arr[] = {3,4,9,1,200,90};
    
    printf("i is %lu\n",sizeof(arr)/sizeof(int));
    
    for (i=0; i<6-1; i++) {
        
        for (j=i+1; j<6; j++) {
            
            if (arr[j] > arr[j+1]) {
                t = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = t;
            }
        }
    }
    
    for (int n=0; n<6; n++) {
        printf(" %d ",arr[n]);
    }
}


